<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>附件上传</title>
    <link rel="icon" th:href="@{../img/title.png}" type="image/ico">
    <meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
    <meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
    <meta name="author" content="yinqi">
    <link th:href="@{/admin/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/admin/css/materialdesignicons.min.css}" rel="stylesheet">
    <link th:href="@{/admin/css/style.min.css}" rel="stylesheet">

    <!--    弹窗-->
    <script th:src="@{/admin/js/admin/blogType.js}"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
</head>

<body>
<div class="container-fluid p-t-15">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-toolbar clearfix">
                    <form class="pull-right search-bar" action="/admin/upload" method="post" enctype="multipart/form-data">
                        <div class="input-group">
                            <div class="input-group-btn">
                                <input type="hidden" name="search_field" id="search-field" value="title">
                                <input class="btn btn-default" id="search-btn" data-toggle="dropdown" type="submit" aria-haspopup="true" aria-expanded="false" value="提交">
                            </div>
                            <input type="file" name="uploadFile" value="请选择文件" class="form-control" >
                        </div>
                    </form>
                    <div class="toolbar-btn-action">
                        <a class="btn btn-primary m-r-5" th:onclick="addBlogType()"><i class="mdi mdi-plus"></i>
                            新增</a>
                        <a class="btn btn-danger" href="#!" th:onclick="delete_Type()"><i
                                class="mdi mdi-window-close"></i> 删除</a>
                        <a class="btn btn-cyan" href="#!" th:onclick="delete_Type()"><i
                                class="mdi mdi-plus-circle"></i> 添加附件</a>
                        <a class="btn btn-pink" href="#!" th:onclick="history.go()"><i
                                class="mdi mdi-rotate-3d"></i> 刷新</a>

                    </div>
                </div>
<!--
      <form action="/admin/upload" method="post" enctype="multipart/form-data">
                            <input type="file" name="uploadFile" value="请选择文件">
                            <input type="submit" value="上传">
                        </form>


 -->

                <div class="card-body">

                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>
                                    <label class="lyear-checkbox checkbox-primary">
                                        <input type="checkbox" id="check-all"><span></span>
                                    </label>
                                </th>
                                <th>ID</th>
                                <th>种类</th>
                                <th>数量</th>
                                <th>添加时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="tbody">

                            <tr th:each="blogType : ${blogTypes}">
                                <td>
                                    <label class="lyear-checkbox checkbox-primary">
                                        <input type="checkbox" name="ids[]" th:value="${blogType.id}"><span></span>
                                    </label>
                                </td>
                                <td th:text="${blogType.id}"></td>
                                <td th:text="${blogType.typeName}"></td>
                                <td th:text="${blogType.num}"></td>
                                <td th:text="${blogType.addTime}"></td>
                                <td>
                                    <div class="btn-group">
                                        <a class="btn btn-xs btn-default"
                                           th:onclick="updateBlogType([[${blogType.typeName}]],[[${blogType.id}]])"
                                           title="编辑"
                                           data-toggle="tooltip"><i
                                                class="mdi mdi-pencil"></i></a>
                                        <a class="btn btn-xs btn-default" title="查看" onclick="Sorry()"
                                           data-toggle="tooltip"><i
                                                class="mdi mdi-eye"></i></a>
                                        <a class="btn btn-xs btn-default"
                                           th:onclick="deleteBlogType([[${blogType.id}]])"
                                           title="删除" data-toggle="tooltip"><i
                                                class="mdi mdi-window-close"></i></a>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <!-- 页码
                    <ul class="pagination">
                        <li class="active">
                            第[[${pageNum}]]页共[[${pageCount}]]页
                            <a th:if="${pageNum>=1}" style="background-color: #33cabb;border: none;color: white;"
                               th:href="@{/admin/page/BlogList/}+(${pageNum}-1)">
                                上一页
                            </a>
                            <a th:if="${pageNum}<=${pageCount}" style="background-color: #33cabb;border: none;color: white;"
                               th:href="@{/admin/page/BlogList/}+(${pageNum}+1)">
                                下一页
                            </a>
                        </li>
                    </ul>
-->
                </div>
            </div>
        </div>

    </div>

</div>

<script type="text/javascript" th:src="@{/admin/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/main.min.js}"></script>
<script type="text/javascript">
    $(function () {
        $('.search-bar .dropdown-menu a').click(function () {
            var field = $(this).data('field') || '';
            $('#search-field').val(field);
            $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
        });
    });
</script>
</body>
</html>